﻿Imports System.Drawing

''' <summary>
''' 对局 目前是1V1
''' </summary>
Public Class Game

    Private players As List(Of Player)
    Private turn As Integer

    Public map As Map

    Private Player1 As Player
    Private Player2 As Player
    Public ReadOnly Setting As GameSetting

    Sub New(ByVal map As Map)

    End Sub

    Sub New(ByVal player1 As Player, ByVal player2 As Player, ByVal setting As GameSetting, ByVal map As Map)
        Me.Player1 = player1
        Me.Player2 = player2
        Me.Setting = setting
        Me.Map = map
        'UnitLoad(Me.Player1, map.Country1)
        'UnitLoad(Me.Player2, map.Country2)
    End Sub

    Private Sub UnitLoad(ByRef player As Player, ByVal units As IEnumerable(Of Integer))
        For Each u As Integer In units
            player.Army.Add(New Unit(player, u))
        Next
    End Sub

    Public Function Start() As Boolean
        Return False
    End Function

    Public Function GetPlayer(ByVal isMain As Boolean) As Player
        Return IIf(isMain, Player1, Player2)
    End Function

    Public Function GetUnitBySite(ByVal Point As Point) As Unit
        Return Nothing
    End Function

    Public Function GetUnitBySite(ByVal Points As List(Of Point)) As List(Of Unit)
        Dim List As New List(Of Unit)
        For Each Point In Points
            List.Add(GetUnitBySite(Point))
        Next
        Return List
    End Function

End Class